//
//  OrderedGoodsCell.m
//  LoveFreshBeen
//
//  Created by 胡不归是大虾 on 2016/10/19.
//  Copyright © 2016年 魏根. All rights reserved.
//

#import "OrderedGoodsCell.h"
@interface OrderedGoodsCell( )
@property (weak, nonatomic) IBOutlet UILabel *nameLable;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *countLable;
@property (weak, nonatomic) IBOutlet UIButton *reduceBtn;
@property (weak, nonatomic) IBOutlet UIButton *addBtn;




@end
@implementation OrderedGoodsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    
}
-(void)setModel:(HMHomeFirstModel *)model{
    _model = model;
    self.nameLable.text = [NSString stringWithFormat:@"[精选]%@",model.name];
    self.priceLabel.text = [NSString stringWithFormat:@"$%.2f",model.partner_price];
    self.countLable.text = [NSString stringWithFormat:@"%ld",model.goodsCount];
}
- (IBAction)didClickBtn:(UIButton *)sender {
    if (sender.tag == 0) {
        self.model.goodsCount --;
        
    }else{
        self.model.goodsCount ++;
    }
    self.countLable.text = [NSString stringWithFormat:@"%ld",self.model.goodsCount];
    if (self.model.goodsCount == 0) {
        [self.delegate goodsCountsEqualToZero:self.model];
    }
    [[NSNotificationCenter defaultCenter] postNotificationName:KChangeGoodCountNoti object:self.model];
}

@end
